package com.ctgu.expresshelper.dao;

import com.ctgu.expresshelper.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

@Mapper
@Component
public interface UserDao {

//    @Insert("insert into user{}")
//    void addUser(String username,String ,String openID);

    @Select("select * from user where openid=#{openid}")
    User selectUserByOpenId(String openId);

    @Insert("insert into user(username,imgUrl,openid,receiveNum,sendNum,sex) values(#{username},#{imgUrl},#{openid},#{receiveNum},#{sendNum},#{sex})")
    void addUser(User user);

    @Update("update user set receiveNum = #{receiveNum} where id=#{userId}")
    int updateReceiveNum(int userId, int receiveNum);


    @Update("update user set sendNum = #{sendNum} where id=#{userId}")
    int updateSendNumNum(int userId, int sendNum);



}
